package com.tree.thread;

/**
 * @ClassName com.tree.thread
 * Description: <类功能描述>. <br>
 * <p>
 * <使用说明>
 * </p>
 * @Author tree
 * @Date 4/12/24 1:21 PM
 * @Version 1.0
 */
public class JoinTest {
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            for (int i = 0; i < 10; i++) {
                System.out.println("t1,i:" + i);
            }
        });
        Thread t2 = new Thread(() -> {
            try {
                t1.join();
            } catch (Exception e) {
                // TODO: handle exception
            }
            for (int i = 0; i < 10; i++) {
                System.out.println("t2,i:" + i);
            }
        });
        Thread t3 = new Thread(() -> {
            try {
                t2.join();
            } catch (Exception e) {
                // TODO: handle exception
            }
            for (int i = 0; i < 10; i++) {
                System.out.println("t3,i:" + i);
            }
        });
        t1.start();
        t2.start();
        t3.start();
    }
}
